package com.youease.generateXML;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class GenerateXml {
	public static void generateXml(String xml,String path) {
		BufferedWriter buffereWriter = null;
		try {
			OutputStreamWriter fileWrite = new OutputStreamWriter(new FileOutputStream(new File(path)), "UTF-8");
            buffereWriter = new BufferedWriter(fileWrite);
            buffereWriter.write(xml);
            buffereWriter.flush();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			if(buffereWriter!=null) {
				try {
					buffereWriter.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
	}
}
